package com.ms.game.slot.base;

import java.math.BigDecimal;

import com.xpec.c4.game.common.Helper;
import com.xpec.c4.game.utility.WeightSelection;

public class GainRateData {

	/**
	 * 辨識的ID
	 */
	private int id;
	
	/**
	 * 是否開放
	 */
	private boolean isOpen;
	
	/**
	 * 增益(幣值比)
	 */
	private BigDecimal gainRate;
	
	/**
	 * 以比例的形式字串
	 */
	private String gainRateStringFormat;
	
	/**
	 * 起始機台編號(包含)
	 */
	private int beginMachineID;
	
	/**
	 * 結尾機台編號(包含)
	 */
	private int endMachineID;
	
	/**
	 * 限制玩家等級(大於等於)
	 */
	private int limitLevel;
	
	/**
	 * 限制玩家VIP等級(大於等於)
	 */
	private int limitVIPLevel;
	
	/**
	 * 是否可以進行任務
	 */
	private boolean isCanDoMission;
	
	/**
	 * 小樂進入最少攜帶的錢
	 */
	private BigDecimal robotLowestCarryMoney = BigDecimal.ZERO;
	
	/**
	 * 小樂額外補錢的權重選擇
	 */
	private WeightSelection<BigDecimal> robotAddMoneySelect;
	
	/**
	 * 取得需要補充的C幣
	 */
	public BigDecimal getRobotFillMoney(BigDecimal playerCoin){
		if(playerCoin == null || robotAddMoneySelect == null || Helper.isGreaterEqual(playerCoin, robotLowestCarryMoney)){
			return BigDecimal.ZERO;
		}
		
		if(robotAddMoneySelect.getTotalWeight() <= 0){
			return BigDecimal.ZERO;
		}
		
		return robotAddMoneySelect.randomSelect();
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public BigDecimal getGainRate() {
		return gainRate;
	}

	public void setGainRate(BigDecimal gainRate) {
		this.gainRate = gainRate;
	}

	public String getGainRateStringFormat() {
		return gainRateStringFormat;
	}

	public void setGainRateStringFormat(String gainRateStringFormat) {
		this.gainRateStringFormat = gainRateStringFormat;
	}

	public int getBeginMachineID() {
		return beginMachineID;
	}

	public void setBeginMachineID(int beginMachineID) {
		this.beginMachineID = beginMachineID;
	}

	public int getEndMachineID() {
		return endMachineID;
	}

	public void setEndMachineID(int endMachineID) {
		this.endMachineID = endMachineID;
	}

	public int getLimitLevel() {
		return limitLevel;
	}

	public void setLimitLevel(int limitLevel) {
		this.limitLevel = limitLevel;
	}

	public int getLimitVIPLevel() {
		return limitVIPLevel;
	}

	public void setLimitVIPLevel(int limitVIPLevel) {
		this.limitVIPLevel = limitVIPLevel;
	}

	public boolean isCanDoMission() {
		return isCanDoMission;
	}

	public void setCanDoMission(boolean isCanDoMission) {
		this.isCanDoMission = isCanDoMission;
	}

	public void setRobotLowestCarryMoney(BigDecimal robotLowestCarryMoney) {
		this.robotLowestCarryMoney = robotLowestCarryMoney;
	}

	public void setAddMoneySelect(WeightSelection<BigDecimal> addMoneySelect) {
		this.robotAddMoneySelect = addMoneySelect;
	}

	public boolean isOpen() {
		return isOpen;
	}

	public void setOpen(boolean isOpen) {
		this.isOpen = isOpen;
	}
	
}
